layui.use(['form','jquery','table','layer'],function() {
    let form = layui.form,
        $ = layui.jquery,
        table = layui.table,
        layer = layui.layer;

    let tabInstance = table.render({
        elem: '#CustomerCompositionList0',
        url: '/Statistical-Report/CustomerComposition/'+$(".search").val(), //数据接口
        page: true, //开启分页
        limit:5, //每页显示的条数，默认10
        limits:[2,5,10,15,], //每页显示条数选择框数据
        request:{
            pageName: 'current',
            limitName: 'size'
        },
        cols: [[ //表头
            {field: 'customerGrade', title: '客户等级', width: 150, sort: true, fixed: 'left'},
            {field: 'count', title: '客户数量'},
        ]]
    });

    form.on('submit(search)',function () {
        if($(".search").val()==-1){
            let tabInstance = table.render({
                elem: '#CustomerCompositionList0',
                url: '/Statistical-Report/CustomerComposition/'+$(".search").val(), //数据接口
                page: true, //开启分页
                limit:5, //每页显示的条数，默认10
                limits:[2,5,10,15,], //每页显示条数选择框数据
                request:{
                    pageName: 'current',
                    limitName: 'size'
                },
                cols: [[ //表头
                    {field: 'customerGrade', title: '客户等级', width: 150, sort: true, fixed: 'left'},
                    {field: 'count', title: '客户数量'},
                ]]
            });
        }
        if($(".search").val()==0){
            let tabInstance = table.render({
                elem: '#CustomerCompositionList0',
                url: '/Statistical-Report/CustomerComposition/'+$(".search").val(), //数据接口
                page: true, //开启分页
                limit:5, //每页显示的条数，默认10
                limits:[2,5,10,15,], //每页显示条数选择框数据
                request:{
                    pageName: 'current',
                    limitName: 'size'
                },
                cols: [[ //表头
                    {field: 'customerSatisfaction', title: '客户信用度', width: 150, sort: true, fixed: 'left'},
                    {field: 'count', title: '客户数量'},
                ]]
            });
        }
        if($(".search").val()==1){
            let tabInstance = table.render({
                elem: '#CustomerCompositionList0',
                url: '/Statistical-Report/CustomerComposition/'+$(".search").val(), //数据接口
                page: true, //开启分页
                limit:5, //每页显示的条数，默认10
                limits:[2,5,10,15,], //每页显示条数选择框数据
                request:{
                    pageName: 'current',
                    limitName: 'size'
                },
                cols: [[ //表头
                    {field: 'customerCredit', title: '客户满意度', width: 150, sort: true, fixed: 'left'},
                    {field: 'count', title: '客户数量'},
                ]]
            });
        }
    })
});